Macromedia Central Development Quick Start Guide
Table of Contents
Testing, Developing, and Debugging the Application
Once you have correctly installed your application into Central, you can set up Flash to publish it directly into Central. This allows you to test and debug your application easily within the Central environment.
This is important because you cannot test your application directly within the Flash authoring environment; it doesn't have integrated support for the Central APIs.
Step 1. Locate the Application Installation Path
The Central installation path for your application is similar to one of the following:
- Windows XP/2000: C:\Documents and Settings\USERNAME\Application Data\Macromedia\Central\#Central\RANDOMSTRING\DOMAINNAME\APPPATH
- Windows 98: C:\Windows\Profiles\rhash\Application
Data\Macromedia\Central\#Central\RANDOMSTRING\DOMAINNAME\APPPATH - Mac OS: Hard Drive/Users/USERNAME/Library/Application Support/Macromedia/Central/#Central/RANDOMSTRING/DOMAINNAME/APPPATH/
Step 2. Set Flash to Publish to the Installation Folder
Once you locate the Central installation path for your application, set Flash to publish directly into that folder and thus into Central:
In Flash MX 2004, select File > Publish Setting > Formats. Click the Folder icon and navigate to the Central installation path for your application. Make sure you save it as the same name as the SWF in that directory.
In Flash MX, select File > Publish Settings > Formats. Uncheck the Use Default Names option and enter the path to the Central installation folder, as well as the name that the file should be published as.
Step 3. Test Your Application
When you publish your application, it will overwrite the SWF installed
into Central. To test this, change the onActivate function
to print a different message on the status bar:
onActivate = function(shell, appID, shellID, baseTabIndex, initialData)
{
//initialization code goes here
shell.setStatus("Loaded Again!");
}
Publish your file (select File > Publish) and switch to Central. In order to see the new file, you must reload the application within Central. You can do this by switching to another application and then back to your application.
Notice that the new version is now running, as evident by text "Loaded Again!" appearing now on the status bar.
Step 4. Debug Your Application Within Central
Now that you can easily publish your application directly into Central, you need an easy way to get debug and trace information from the application as it runs within Central.
When you test non-Central applications within Flash, you get this
information using the trace() function and the Output
panel. The process is very similar to testing applications within Central
because it uses the trace() function and the Central Debug
panel.
To test this, open the Debug panel within Flash:
- Flash MX 2004: Window > Other Panels > Central Debug Panel
- Flash MX: Window > Central Debug Panel
Next, add some trace statements to your application like so:
onActivate = function(shell, appID, shellID, baseTabIndex, initialData)
{
//initialization code goes here
shell.setStatus("Loaded Again!");
trace("onActivate Called");
}
Publish your application and reload it in Central. Switch back to Flash and you should see "onActivate Called" within the Debug panel.
One of the cool things about the Debug panel is that it provides rich output for complex data types. For example, replace your onActivate method with the code before and then test the application within Central:
onActivate = function(shell, appID, shellID, baseTabIndex, initialData)
{
var homer = new Object();
homer.firstName = "Homer"
homer.lastName = "Simpson"
var children_arr = new Array();
children_arr.push("Bart");
children_arr.push("Maggie");
children_arr.push("Lisa");
homer. children = children_arr;
trace(homer);
}
If you were to trace this within Flash, the Output panel would show this:
[Object object]
However, tracing this within the Debug panel in Central shows this:
Object : object children : Array [0] : Bart [1] : Maggie lastName : Simpson firstName : Homer
As you can see, this provides much richer output and gives you insight into all of the data, rather than just the first level.
You now have the basic skills necessary to begin developing complex applications for Macromedia Central. Your next steps involve creating your application and adding pods and agents—topics for another day.